﻿using System;
using System.Linq;
using System.Web;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using CSBackup_Web.Sources.Override;

namespace CSBackup_Web.Models
{
    public class HomeModel : CommonModel
    {
        public HomeModel()
        {
            Title = "主页";
            TabTitles = new List<string> { "备份", "恢复", "日志" };
            fileListValues = new List<bool>();
            projInfo = new ProjectInfo();
        }
        private List<string> fileList = new List<string>();
        private List<bool> fileListValues = new List<bool>();
        private ProjectInfo projInfo;
        private string bkpType;
        private string grainType;
        private bool isAuto;
        private string logStart;
        private string logEnd;
        private List<List<string>> logInfo = new List<List<string>>();
        private List<List<string>> logInfoFull = new List<List<string>>();
        private int activeTab = 0;
        private string bkpListType = "";
        private List<string> bkpList = new List<string>();
        private int bkpListSelected;
        private string bkpWay = "";
        private string bkpTime = "";
        private string bkpSize = "";
        private string bkpCnt = "";
        private string bkpDpnd = "";
        private List<string> typeList = new List<string>();
        private string chosenType = "";
        private bool restoreMobile = false;
        private bool syncBkp = false;
        public bool SyncBkp
        {
            get { return syncBkp; }
            set { syncBkp = value; }
        }
        public bool RestoreMobile
        {
            get { return restoreMobile; }
            set { restoreMobile = value; }
        }
        public List<string> FileList
        {
            get { return fileList; }
            set { fileList = value; }
        }
        public string ChosenType
        {
            set { chosenType = value; }
            get { return chosenType; }
        }
        public List<string> TypeList
        {
            set { typeList = value; }
            get { return typeList; }
        }
        public string BkpTime
        {
            set { bkpTime = value; }
            get { return bkpTime; }
        }
        public string BkpSize
        {
            set { bkpSize = value; }
            get { return bkpSize; }
        }
        public string BkpCnt
        {
            set { bkpCnt = value; }
            get { return bkpCnt; }
        }
        public string BkpDpnd
        {
            set { bkpDpnd = value; }
            get { return bkpDpnd; }
        }
        public string BkpWay
        {
            set { bkpWay = value; }
            get { return bkpWay; }
        }
        public int BkpListSelected
        {
            set { bkpListSelected = value; }
            get { return bkpListSelected; }
        }
        public List<string> BkpList
        {
            set { bkpList = value; }
            get { return bkpList; }
        }
        public string BkpListType
        {
            set { bkpListType = value; }
            get { return bkpListType; }
        }
        public int ActiveTab
        {
            set { activeTab = value; }
            get { return activeTab; }
        }
        public List<List<string>> LogInfoFull
        {
            set { logInfoFull = value; }
            get { return logInfoFull; }
        }
        public List<List<string>> LogInfo
        {
            set { logInfo = value; }
            get { return logInfo; }
        }
        [Required(ErrorMessage = "开始日期不可为空")]
        public string LogStart
        {
            set { logStart = value; }
            get { return logStart; }
        }
        [Required(ErrorMessage = "结束日期不可为空")]
        public string LogEnd
        {
            set { logEnd = value; }
            get { return logEnd; }
        }
        public List<bool> FileListValues
        {
            get { return fileListValues; }
            set { fileListValues = value; }
        }
        public ProjectInfo ProjInfo
        {
            set
            {
                projInfo = value;
                if (fileListValues.Count != projInfo.CurrentBackup.FileList.Count)
                {
                    fileListValues.Clear();
                    for (int num = 0; num < projInfo.CurrentBackup.FileList.Count; num++)
                    {
                        fileListValues.Add(true);
                    }
                }
            }
            get { return projInfo; }
        }
        public string BkpType
        {
            get { return bkpType; }
            set { bkpType = value; }
        }
        public string GrainType
        {
            get { return grainType; }
            set { grainType = value; }
        }
        public bool IsAuto
        {
            get { return isAuto; }
            set { isAuto = value; }
        }
    }
}